{{- define "gcp_cloud_config" }}
[Global]
project-id = {{ index (.Values.cloudProviderGcp.internal.providerClusterConfiguration.provider.serviceAccountJSON | fromJson) "project_id" | quote }}
regional = true
multizone = true
network-name = {{ .Values.cloudProviderGcp.internal.providerDiscoveryData.networkName | quote }}
subnetwork-name = {{ .Values.cloudProviderGcp.internal.providerDiscoveryData.subnetworkName | quote }}
# This will force the OAuth client to fall back to use service account key
token-url = "nil"
node-instance-prefix = {{ .Values.global.clusterConfiguration.cloud.prefix }}
# node-tags = {{ .Values.global.clusterConfiguration.cloud.prefix }}
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
  name: cloud-controller-manager
  namespace: d8-cloud-provider-gcp
  {{- include "helm_lib_module_labels" (list . (dict "app" "cloud-controller-manager")) | nindent 2 }}
type: Opaque
data:
  cloud-config: {{ include "gcp_cloud_config" . | b64enc | quote }}
  credentials.json: |
    {{- .Values.cloudProviderGcp.internal.providerClusterConfiguration.provider.serviceAccountJSON | b64enc | nindent 4 }}
